package cocurrency.threadpool;

import java.util.concurrent.CountDownLatch;

/**
 * Created by luzl on 4/7/2017.
 */
public class PrintThread implements Runnable {

    private CountDownLatch countDownLatch;
    private String name;

    public PrintThread(CountDownLatch countDownLatch,String name){
        this.countDownLatch=countDownLatch;
        this.name=name;
    }

    @Override
    public void run() {
        System.out.println(name+" I am waiting latch");
        try {
            this.countDownLatch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(name+" I am done");
    }
}
